//
//  HttpClientManager.h
//  xqt
//
//  Created by Senela on 14-12-18.
//  Copyright (c) 2014年 myqu. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFHTTPSessionManager.h"
#import "NSMutableDictionary+Utils.h"
#import "DataModel.h"

#define PAGESIZE 10
#define BASEURL @"http://121.40.62.218:80/"

#pragma mark -------------  Notification Name
//定义所有通知的名称
#define Notify_ShowSelectedViewController  @"ShowSelectedViewController"  //选择个人中心里,首页跳转到指定ViewController发出的通知
#define Notify_ShowPersonalInfoView @"ShowPersonalInfoView" //显示个人中心

#define Notify_ShowGuideToParkPort @"ShowGuideToParkPort" // 显示导航

#define Notify_ShowBookParkingPort @"ShowBookParkingPort" //显示停车场预约界面

#define Notify_LogoutNotify @"LogoutNotify" //退出通知

#define Notify_ChooseParkingSpace @"ChooseParkingSpace" //用户选择预约停车位信息 

//定义所以保存本地数据的Key
#define NsUserDefaultKey_LoginModel @"LoginModel" //登录用户
#define NsUserDefaultKey_LocationModel @"LocationModel" //用户地理位置信息
#define NsUserDefaultKey_TicketsArray @"TicketsArray" //优惠券信息

//#define Parking_Type_Num 50 //停车位 >= 50 显示为闲

typedef void(^ResponseBlock)(JsonRetMsg  *response);
typedef void(^ResponseErrorBlock)(JsonRetMsg *responseObject);


@interface HttpClientManager : AFHTTPSessionManager

+ (instancetype)sharedClient;


-(void)requestImageInfoWithUrl:(NSString *)url imgView:(UIImageView *)imgView;

-(void)requestImageInfoWithUrl:(NSString *)url imgView:(UIImageView *)imgView placeholderImage:(NSString*)placeImgStr;

-(UIImage *)loadImgeWithName:(NSString *)imgStr;


#pragma mark ----- public Action
/**
 *  用户登录
 *
 *  @param mobilephone <#mobilephone description#>
 *  @param authcode    <#authcode description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)loginRequestWithMobilePhone:(NSString *)mobilephone
                       WithAuthCode:(NSString *)authcode
                    WithSucessBlock:(ResponseBlock )sucessBlock
                    withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  添加车牌
 *
 *  @param mobilephone     <#mobilephone description#>
 *  @param userid          <#userid description#>
 *  @param provincename    沪
 *  @param carnumbersuffix A123456
 *  @param isprimary       是否是主车 1 是 0 否
 *  @param sucessBlock     <#sucessBlock description#>
 *  @param failedBlock     <#failedBlock description#>
 */
- (void)addCarRequestWithMobilePhone:(NSString *)mobilephone
                          WithUserId:(NSString *)userid
                    WithProvincename:(NSString *)provincename
                 Withcarnumbersuffix:(NSString *)carnumbersuffix
                       WithIsprimary:(NSString *)isprimary
                     WithSucessBlock:(ResponseBlock )sucessBlock
                     withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  首页地图搜索
 *
 *  @param cityno      城市代码
 *  @param userid      <#userid description#>
 *  @param gpslat      纬度
 *  @param gpslon      经度
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)mapParkingSearchRequestWithCityNo:(NSString *)cityno
                               WithUserId:(NSString *)userid
                               Withgpslat:(NSString *)gpslat
                               Withgpslon:(NSString *)gpslon
                          WithSucessBlock:(ResponseBlock )sucessBlock
                          withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  获取停车场信息
 *
 *  @param parkingid   <#parkingid description#>
 *  @param userid      <#userid description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)ParkingPortDetailRequestWithParkingId:(NSString *)parkingid
                                   WithUserId:(NSString *)userid
                              WithSucessBlock:(ResponseBlock )sucessBlock
                              withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  预约支付
 *
 *  @param parkingid                      <#parkingid description#>
 *  @param userid                         <#userid description#>
 *  @param firstpreBookingParkingSpaceNo  第一个车位号
 *  @param firstpreBookingParkingCarNo    第一个停车牌号
 *  @param secondpreBookingParkingSpaceNo 第二个车位号
 *  @param secondpreBookingParkingCarNo   第二个停车牌号
 *  @param sucessBlock                    <#sucessBlock description#>
 *  @param failedBlock                    <#failedBlock description#>
 */
- (void)payBookParkingSpaceRequestWithParkingId:(NSString *)parkingid
                                     WithUserId:(NSString *)userid
              WithFirstpreBookingParkingSpaceNo:(NSString *)firstpreBookingParkingSpaceNo
                WithFirstpreBookingParkingCarNo:(NSString *)firstpreBookingParkingCarNo
             WithSecondpreBookingParkingSpaceNo:(NSString *)secondpreBookingParkingSpaceNo
               WithSecondpreBookingParkingCarNo:(NSString *)secondpreBookingParkingCarNo
                                WithSucessBlock:(ResponseBlock )sucessBlock
                                withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  查询我的预约订单
 *
 *  @param mobilephone <#mobilephone description#>
 *  @param userid      <#userid description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)myBookOrdersRequestWithMobilephone:(NSString *)mobilephone
                                WithUserId:(NSString *)userid
                           WithSucessBlock:(ResponseBlock )sucessBlock
                           withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  查询预约订单详情
 *
 *  @param orderno     <#orderno description#>
 *  @param userid      <#userid description#>
 *  @param ordertype   <#ordertype description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)orderDetailRequestWithOrderno:(NSString *)orderno
                           WithUserId:(NSString *)userid
                        WithOrdertype:(NSString *)ordertype
                      WithSucessBlock:(ResponseBlock )sucessBlock
                      withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  查询我的车牌列表
 *
 *  @param userid      userid description
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)myCarsListRequestWithUserId:(NSString *)userid
                    WithSucessBlock:(ResponseBlock )sucessBlock
                    withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  取消预约订单
 *
 *  @param orderno     <#orderno description#>
 *  @param userid      <#userid description#>
 *  @param mobilephone <#mobilephone description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)cancelBookOrderRequestWithOrderno:(NSString *)orderno
                               WithUserId:(NSString *)userid
                          WithMobilePhone:(NSString *)mobilephone
                          WithSucessBlock:(ResponseBlock )sucessBlock
                          withFailedBlock:(ResponseErrorBlock )failedBlock;

/**
 *  支付预约订单
 *
 *  @param orderno     <#orderno description#>
 *  @param userid      <#userid description#>
 *  @param mobilephone <#mobilephone description#>
 *  @param sucessBlock <#sucessBlock description#>
 *  @param failedBlock <#failedBlock description#>
 */
- (void)payBookOrderRequestWithOrderno:(NSString *)orderno
                            WithUserId:(NSString *)userid
                       WithMobilePhone:(NSString *)mobilephone
                       WithSucessBlock:(ResponseBlock )sucessBlock
                       withFailedBlock:(ResponseErrorBlock )failedBlock;

@end
